import { ConsoleLogger, Module } from '@nestjs/common';
import { LoginService } from './login.service';
import { LoginResolver } from './login.resolver';
import { UserService } from '../user/user.service';
import { TypeOrmModule } from '@nestjs/typeorm';
import { User } from '../user/models/user.entity';
import { JwtStrategy } from './jwt.strategy';
import { JwtModule } from '@nestjs/jwt';
import { JWT_SECRET } from '../../constant';
import { StudentService } from '../student/student.service';
import { StudentResolver } from '../student/student.resolver';
import { Student } from '../student/models/student.entity';
import { CardRecordService } from '../cardRecord/cardRecord.service';
import { CardRecord } from '../cardRecord/models/cardRecord.entity';
import { ProductService } from '../product/product.service';
import { Product } from '../product/models/product.entity';
import { OrderService } from '../order/order.service';
import { Order } from '../order/models/order.entity';

@Module({
  imports: [
    JwtModule.register({
      secret: JWT_SECRET,
      signOptions: {
        expiresIn: 60 * 60 * 7 * 24 + 's',
      },
    }),
    TypeOrmModule.forFeature([User, Student, CardRecord, Product, Order]),
  ],
  providers: [
    ConsoleLogger,
    LoginService,
    LoginResolver,
    UserService,
    JwtStrategy,
    StudentService,
    StudentResolver,
    CardRecordService,
    ProductService,
    OrderService,
  ],
  exports: [LoginService],
})
export class LoginModule {}
